<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
    <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css">
    <link href="/js/ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <link href="/js/plugins/datepicker/datepicker.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.min.js"></script>
    <script type="text/javascript" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="/js/plugins/datepicker/datepicker.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>

    <link href="/js/plugins/chosen/chosen.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/plugins/chosen/chosen.jquery.js"></script>
    <script type="text/javascript" src="/js/system/common.js"></script>
    <#--<script type="text/javascript" src="/js/system/addtravelnote.js"></script>-->
    <script type="text/javascript" src="/js/system/addanswernote.js"></script>
    <script>
        $(function () {
            $(".chose_pic").click(function () {
                $("#coverBtn").click();
            })
            $("#coverBtn").change(function () {
                if (this.value) {
                    $("#coverForm").ajaxSubmit(function (data) {
                        $(".choseBtn").html(" + 重新选择");
                        $("#coverImage").attr("src", "/" + data);
                        $("#coverValue").val("/" + data);
                    })
                }
            })

            //保存或发表
            $(".btn_submit, .btn_save").click(function () {
                /*var labels = [];
                $('.pi-tagitem span').each(function (index, value) {
                    labels.push($(value).text());
                })
                $("#tagInput").val(labels.join(","))*/
                $("#editForm").ajaxSubmit(function (data) {
                    if (data.success) {
                        window.location.href = "/question/detail?questionId=" + data.data
                    } else {
                        popup("操作失败");
                    }
                })
            })
            //内容回显
            if('${tv!}'){
                ue.setContent('${(tv.travelContent.content)!}');
            }
        })
    </script>
</head>


<body>
    <#assign currentNav="question">
    <#include "../common/navbar.ftl">

<!--文件上传-->
<form action="/coverImageUpload" method="post" id="coverForm">
    <input type="file" name="pic" id="coverBtn" style="display: none;">
</form>

<div class="wrapper">
    <div class="ap-head">
        <h1>发表回复</h1>
        <div class="clearfix"></div>
    </div>
    <div class="ap-wrap">
        <div class="ap-main">
            <form class="forms" action="/question/saveAnswer" method="post" id="editForm">
                <input type="hidden" name="questionId" id="questionId" value="${(qo.questionId)!}">
                <dl>
                    <dd>
                        <div class="chose_pic">
                            <img id="coverImage"><span class="choseBtn">+ 选择封面</span>
                            <input type="hidden" name="coverUrl" id="coverValue" >
                        </div>
                    </dd>
                </dl>
                <dl class="body cf">
                    <dd id="content_div">
                        <script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
                    </dd>
                </dl>
                    <div class="btns">
                    <input class="btn_submit" value="发表" type="button">
                            </div>
            </form>
        </div>
    </div>
</div>
    <#include "../common/footer.ftl">
</body>

</html>

